<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>课程详情</title>
    <script th:src="@{/js/jquery.min.js}"></script>
    <style>
        table {
            border-color: #000000;
            border-collapse: collapse; /*设置单元格的边框合并为1*/
            width: 50%;
            text-align: center;
        }

        td {
            border-color: #000000;
        }

        th {
            background: #F4F4F4;
        }

        table tr:nth-child(odd) {
            background: #FFFFFF;
        }

        table tr:nth-child(even) {
            background: #F4F4F4;
        }
    </style>
    <script type="text/javascript">
        function scoreInput(stuName,stuId,courseId) {
            var score = prompt("请输入"+stuName+"分数","0.00");
            if (score != null && score != "") {
                $.ajax({
                    type: "GET",
                    url: "/course/scoreInput",
                    data: "stuId=" + stuId+"&courseId="+courseId+"&score="+score,
                    success: function (resp) {
                        window.location.reload()
                    },
                });
            }
        }
    </script>
</head>
<body>
<h1>课程详情</h1>
<table border="1">
    <thead>
    <th>编号</th>
    <th>课程名称</th>
    <th>代课老师名称</th>
    <th>班级</th>
    <th>上课时间</th>
    </thead>
    <tbody>
    <tr>
        <td th:text="${session.courseInfo.id}"></td>
        <td th:text="${session.courseInfo.name}"></td>
        <td th:text="${session.courseInfo.teacherName}"></td>
        <td th:text="${session.courseInfo.classzName}"></td>
        <td th:text="${session.courseInfo.startTime}"></td>
    </tr>
    </tbody>
</table>
<br>
<h2>选课学生列表</h2>
<table border="1">
    <thead>
    <th>编号</th>
    <th>学号</th>
    <th>班级</th>
    <th>姓名</th>
    <th>性别</th>
    <th>学院</th>
    <th>专业</th>
    <th>分数</th>
    <th>操作</th>
    </thead>
    <tbody>
    <tr th:each="subject:${session.students}">
        <td th:text="subject != null ? ${subject.id}:''"></td>
        <td th:text="subject != null ? ${subject.stuNo}:''"></td>
        <td th:text="subject != null ? ${subject.classzName}:''"></td>
        <td th:text="subject != null ? ${subject.stuName}:''"></td>
        <td th:text="subject != null ? ${subject.stuSex}:''"></td>
        <td th:text="subject != null ? ${subject.stuCollege}:''"></td>
        <td th:text="subject != null ? ${subject.stuMajor}:''"></td>
        <td th:text="subject != null ? ${subject.score}:''"></td>
        <td><input th:onclick="scoreInput([[${subject != null ?subject.stuName : ''}]],[[${subject != null ? subject.id : ''}]],[[${subject != null ? session.courseInfo.id : ''}]])" type="button" value="成绩录入"/></td>
    </tr>
    </tbody>
</table>
<br>
<a style="margin-top:100px;border: black 1px solid;" href="/index">返回首页</a>
</body>
</html>